<?php
/**
 * 阿里短信发送
 * @author tang
 */
namespace app\common\lib;

use app\common\lib\AliSms;
use app\common\lib\Redis;
class Task{
    //发送短信验证码
    public function sendSms($data,$serv) {
        try {
            $response = AliSms::sendSmsCode($data['phone'], $data['code']);
        } catch (Exception $exc) {
            return false;
        }
        
        //发送成功
        if($response->Code == "OK"){
            Redis::getInstance()->set('smscode_'.$data['phone'],$data['code'],1800);
        } else {
            return false;
        }
        
    }
}

